<?php
/**
 * List of Contact Receive & Anwsers Messages
 */
use Orx\Mailer\MailBox\Message;
use Fox\Ddic\DataElement\Behavior;
use Fox\Behaviors;
use Hive\Ressource;
use Fox\Generator;
use Fox\Html\Button;
$xview =  Xview::instance();
/* @var $contact Hive\Ressource */
$contact = $xview->component('ressource', 'object');

// Customizing
$customizing = Hive\Ressource\Customizing::instance();
$customizing->trackSummaryPage(array('mod' => 'ressource','act'=>'messages'));

$rid = $contact->getId();
$header = new Fox\Html\Header\Content('messages',Msg(Hive::BUNDLE,Hive::MESSAGES));

$header->add(new Button('add','?',Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::NEW_MESSAGE)))
		->color(Button::COLOR_WARNING)
		->behaviors(Behaviors::action(
				Generator::url('messages','new',null,array('summary' => true,'rid' => $contact->getId())),
				false,null,null,false,'POST',null,null,'messages-container'));
// 1. Check for new emails
$xview->module(Generator::url('messages','synchronize',null,array('json' => false)));


?>
<div id="messagesContent">
	<div><?php echo $header->render();?></div>
	<div class="contentArea">
		<div class="mbs gsl" id="messages-container">
				<?php echo $xview->module(Generator::url('messages','list',null,array('area' => 'contact','summary' => true,'reference' => $rid,'container' => 'messages-container'))); ?>
		</div>
	</div>
</div>